<?php /* Smarty version Smarty-3.1.6, created on 2018-05-29 16:48:15
         compiled from "D:/phpStudy/PHPTutorial/WWW/myshop/Home/View\Order\makeorder.html" */ ?>
<?php /*%%SmartyHeaderCode:13559608825b010d30622750-54473209%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    '5ad309fc9e2d69695fa012183b38bbeb9df69ed4' => 
    array (
      0 => 'D:/phpStudy/PHPTutorial/WWW/myshop/Home/View\\Order\\makeorder.html',
      1 => 1527583678,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '13559608825b010d30622750-54473209',
  'function' => 
  array (
  ),
  'version' => 'Smarty-3.1.6',
  'unifunc' => 'content_5b010d306f6c9',
  'variables' => 
  array (
    'goods' => 0,
    'v' => 0,
    'totalprice' => 0,
    'address' => 0,
    'score' => 0,
  ),
  'has_nocache_code' => false,
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_5b010d306f6c9')) {function content_5b010d306f6c9($_smarty_tpl) {?><!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>提交订单</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="format-detection" content="telephone=no">
<meta name="renderer" content="webkit">
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="stylesheet" href="<?php echo @PUBLIC_PATH;?>
css/amazeui.min.css"/>
<link rel="stylesheet" href="<?php echo @IMAGES_PATH;?>
style.css"/>
<script src="<?php echo @PUBLIC_PATH;?>
js/jquery.min.js"></script>
<script src="<?php echo @PUBLIC_PATH;?>
js/amazeui.min.js"></script>
<style type="text/css">
	.cart-panel-ul > li{
		height: 200px;
	}
	.up-radio-item{
		width: 95%;
		line-height: 60px;
		height: 60px;
	}
	.up-radio-item p{
		line-height: 30px;
		height: 30px;
		margin-top: 0px;
		margin-bottom: 0px;
	}
	.up-radio-item span {
		height:4rem;
	    background: #497bae;
	    color: #fff;
	    line-height: 4rem;
	    margin: 7px 10px 0px 0px;
	    border-radius: 5px;
	    padding: 0px 10px;
	    position: absolute;
	    float: right;
	    right: 0;
	    top: 26px;
}

</style>
</head>

<body>
<div class="container">
	<!--引入头文件-->
	<?php echo $_smarty_tpl->getSubTemplate ("../header.html", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array(), 0);?>

	<script>$('.title-link').text("提交订单")</script>

	<div class="gray-panel">
    	<div class="paoduct-title-panel">
        	<h2 class="checkout-h2"><span class="am-badge am-round am-badge-warning ">1</span> 确认订单信息</h2>
			<div class="cart-list-panel">
                <ul class="am-avg-sm-1 cart-panel-ul">
                   <?php  $_smarty_tpl->tpl_vars['v'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['v']->_loop = false;
 $_smarty_tpl->tpl_vars['k'] = new Smarty_Variable;
 $_from = $_smarty_tpl->tpl_vars['goods']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['v']->key => $_smarty_tpl->tpl_vars['v']->value){
$_smarty_tpl->tpl_vars['v']->_loop = true;
 $_smarty_tpl->tpl_vars['k']->value = $_smarty_tpl->tpl_vars['v']->key;
?>
                   <li>
                        <div class="imgpanel"><a href="#"><img src="<?php echo $_smarty_tpl->tpl_vars['v']->value['main_img'];?>
" class="am-img-responsive" /></a></div>
                        <div class="infopanel">
                            <h3><a href="#"><?php echo $_smarty_tpl->tpl_vars['v']->value['name'];?>
</a></h3>
                            <p style="display: none;"><?php echo $_smarty_tpl->tpl_vars['v']->value['id'];?>
</p>
                            <p style="display: none;"><?php echo $_smarty_tpl->tpl_vars['v']->value['quantity'];?>
</p>
                            <p>价格：<span class="red2 bold"><?php echo $_smarty_tpl->tpl_vars['v']->value['price'];?>
</span> 积分  X <?php echo $_smarty_tpl->tpl_vars['v']->value['quantity'];?>
</p>
                        </div>
                    </li>
                    <?php } ?>
                </ul>
            </div>
            <div class="cart_foot">共<span class="red2 bold" id="total_good"><?php echo count($_smarty_tpl->tpl_vars['goods']->value);?>
</span>件商品；总价：<span class="red2 bold" id="total_amount"><?php echo $_smarty_tpl->tpl_vars['totalprice']->value;?>
</span>积分</div>
            <div class="cart-tool">
                <a class="am-btn am-btn-sm am-btn-success am-radius" href="shoppingcart.html">
                  <i class="am-icon-chevron-left"></i>
                  返回购物车
                </a>
            </div>
        </div>
        <div class="paoduct-title-panel">
        	<h2 class="checkout-h2"><span class="am-badge am-round am-badge-warning ">2</span> 确认收货地址</h2>
            <p><i class="am-icon-location-arrow"></i> 收货地址</p>
            <div class="withdrawals-panel" style="height: calc(<?php echo count($_smarty_tpl->tpl_vars['address']->value)+1;?>
 * 100px);">
        	<?php  $_smarty_tpl->tpl_vars['v'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['v']->_loop = false;
 $_smarty_tpl->tpl_vars['k'] = new Smarty_Variable;
 $_from = $_smarty_tpl->tpl_vars['address']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['v']->key => $_smarty_tpl->tpl_vars['v']->value){
$_smarty_tpl->tpl_vars['v']->_loop = true;
 $_smarty_tpl->tpl_vars['k']->value = $_smarty_tpl->tpl_vars['v']->key;
?>
        	<div class="am-radio up-radio-item" style="position: relative;font-size: 17px;">
              <label>
                <input type="radio" name="addressuid" value="<?php echo $_smarty_tpl->tpl_vars['v']->value['uid'];?>
" <?php if ($_smarty_tpl->tpl_vars['v']->value['first']==1){?>checked<?php }?> style="width: 20px; height: 20px;position: relative; top: 10px;">
                	<p style="position: relative; top: 16px;left: 4px;"><i class="am-icon-user"></i><?php echo $_smarty_tpl->tpl_vars['v']->value['name'];?>
<i class="am-icon-phone" style="margin-left: 30px;"></i><?php echo $_smarty_tpl->tpl_vars['v']->value['phone'];?>
</p>
                	<p style="position: relative;left: 4px;margin-top: 19px;width: 65%;text-overflow:ellipsis;  white-space:nowrap;overflow:hidden;"><?php echo $_smarty_tpl->tpl_vars['v']->value['province'];?>
<?php echo $_smarty_tpl->tpl_vars['v']->value['city'];?>
<?php echo $_smarty_tpl->tpl_vars['v']->value['town'];?>
<?php echo $_smarty_tpl->tpl_vars['v']->value['detail'];?>
</p>
                	<?php if ($_smarty_tpl->tpl_vars['v']->value['first']==1){?>
                	<a><span class="am-fr" style="right: 4rem;">默认</span></a>
                	<?php }?>
              </label>
            </div>
            <?php } ?>
            <div style="text-align: center;margin-top: 35px;position: relative;width: 100%;">
            	<a href="<?php echo @__MODULE__;?>
/User/addaddress/userid/<?php echo $_SESSION['id'];?>
" class="am-btn am-btn-danger am-btn-block am-radius" style="width:60%;position: absolute; left: 20%;">添加新地址</a>
            </div>
        </div>
        </div>
        <div class="paoduct-title-panel">
        	<h2 class="checkout-h2"><span class="am-badge am-round am-badge-warning ">3</span> 支付方式</h2>
            <ul class="am-list am-text-sm my-pay-ul">
            	<!--<li><a href="javascript:;" rel="1" class="hover"><span class="am-fr"><i class="am-icon-check-circle"></i>&nbsp;&nbsp;</span>&nbsp;&nbsp;&nbsp;&nbsp;<img src="<?php echo @IMAGES_PATH;?>
wechat.png" class="payimg" />&nbsp;&nbsp;&nbsp;&nbsp;微信支付</a></li>
                <li><a href="javascript:;" rel="2"><span class="am-fr"><i class="am-icon-circle-thin"></i>&nbsp;&nbsp;</span><img src="<?php echo @IMAGES_PATH;?>
alipay.png" class="payimg" /> 支付宝支付</a></li>-->
                <li><a><span class="am-fr">&nbsp;&nbsp;</span>&nbsp;&nbsp;&nbsp;&nbsp;<img src="<?php echo @IMAGES_PATH;?>
money.png" class="payimg" />&nbsp;&nbsp;&nbsp;&nbsp;积分支付 &nbsp;&nbsp; <samll class="my-pay-yue">积分余额：<span class="red2"><?php echo $_smarty_tpl->tpl_vars['score']->value;?>
</span>  &nbsp;&nbsp;</samll></a></li>
            </ul>
            
            <div>
            	<ul class="am-avg-sm-2 am-text-center">
                	<li class="am-text-center am-padding-sm"><button type="button" class="am-btn am-btn-danger am-btn-block am-radius payorder">提交订单</button></li>
                    <li class="am-text-center am-padding-sm"><button type="button" class="am-btn am-btn-success am-btn-block am-radius">继续购物</button></li>
                </ul>
            </div>
        </div>
    </div>
    
    <footer data-am-widget="footer" class="am-footer am-footer-default" data-am-footer="{  }">
        <hr data-am-widget="divider" style="" class="am-divider am-divider-default"/>
      <div class="am-footer-miscs ">
        <p>CopyRight©2014 AllMobilize Inc.</p>
        <p>京ICP备13033158</p>
      </div>
    </footer>
    <!--底部-->
    <?php echo $_smarty_tpl->getSubTemplate ("../footer.html", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array(), 0);?>

</div>
<script type="text/javascript">
	$('.up-radio-item').height($('.up-radio-item').width()*0.17);
	
		$('.payorder').click(function(){
			
		if(!$("input[name='addressuid']:checked").val()){
			alert("尚未选择地址");
			return
		}
		
		var i=0;
		var goods=new Array();
		$('.cart-panel-ul').find('li').each(function() { //获取所有商品id和数量信息
//              console.log($(this));
                var id=$(this).children(".infopanel").children("p:eq(0)").text();
                var quantity=$(this).children(".infopanel").children("p:eq(1)").text();
            	goods[i]={
            		id:id,
            		quantity:quantity,
            	}
            	i++;
//				console.log(id)
//				console.log(quantity)
		})
		var data={ 
			goods:goods,
			addressuid:$("input[name='addressuid']:checked").val(),
			
		}
		$.post("<?php echo @__MODULE__;?>
/Order/payorder", data,function(ret){
			console.log(ret);
			if(ret.errorcode){ //失败
				alert(ret.error);
			}else{ //下单成功
				window.location.href="<?php echo @__CONTROLLER__;?>
/orders"
			}
		})
//		console.log(data);
	})
</script>
</body>
</html>
<?php }} ?>